package com.imau.mapper;

import com.imau.bean.User;
import io.mybatis.mapper.Mapper;
import io.mybatis.mapper.base.EntityProvider;
import io.mybatis.provider.Caching;
import org.apache.ibatis.annotations.*;

public interface UserMapper extends Mapper<User,String> {

    @Lang(Caching.class)
    @InsertProvider(
            type = EntityProvider.class,
            method = "insert"
    )
    @Options(
            useGeneratedKeys = false,//不使用数据库的自动主键生成
            keyProperty = "id"
    )
    <S extends User> int insert(S entity);


    //维护中间表的Mapper

    @Select("select  * from t_user where mobile = #{mobile}")
    User selectByMobileUser(@Param("mobile") String mobile);
}
